
(1) In programs, DFS and BFS algrithms are implemented.
(2) In programs, I suppose the starting node is n1 and the goal node is n5. 
(3) To be more specific, refer to the comments in programs.
(4) The two java programs were Successfully compliled and run by JCreator Pro 3.50 with JDK 1.5.0 on Windows 2000 Professional. 
(5) Otherwise, we can use the following commands to compile and run on DOS or Unix if the JDK 1.5.0 installed:
 

>javac Breadth.java
>java Breadth

>javac Depth.java
>java Depth